package com.example.消息过期.ttlqueue;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TTLQueue {

    @Autowired
    RabbitTemplate rabbitTemplate;

    @GetMapping("/sendDealyQueue")
    public void send() {
        Message message = MessageBuilder.withBody("hello".getBytes())
            .build();
        rabbitTemplate.convertAndSend(DelayQueueConfig.DELAY_QUEUE_DELAY_QUE, "哈哈");
    }

}
